package com.example.seckillweb.service.impl;

import com.example.seckillweb.mapper.Order;
import com.example.seckillweb.mapper.OrderMapper;
import com.example.seckillweb.service.OrderService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;

/**
* @author smc
* @description 针对表【goods】的数据库操作Service
* @createDate 2023-12-18 21:25:55
*/
@Service
public class OrderServiceImpl implements OrderService {

    @Autowired
    private OrderMapper orderMapper;

    @Override
    public Integer generateOrder(Integer goodsId, Integer userId) {
        Order order = new Order();
        order.setGoodsId(goodsId);
        order.setUserId(userId);
        order.setCreateTime(new Date());
        return orderMapper.insertSelective(order);
    }
}
